package com.sz.controller;


import com.sz.pojo.Items;
import com.sz.service.ItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/items")
public class ItemsController {

    @Autowired
    private ItemsService itemsService;

    @GetMapping("/findAll")
    public String findAll(Model model){

        System.out.println("Hello Word");
        System.out.println("Hello Word");

        List<Items> list = itemsService.findAll();
        model.addAttribute("list",list);
        return "items";
    }

}
